import api from "@/util/api";

const researchersApi = {
  findAll(pageNum, size, params = {}) {
    return api
      .get("/researchers", {
        //发送请求
        params: {
          pageNum,
          size,
          ...params,
        },
      })
      .then((resp) => resp.data);
  },
  removeAll(ids) {
    return api.delete("/researchers", { data: ids }).then((resp) => resp.data);
  },
  save(researchers) {
    return api.post("/researchers", researchers).then((resp) => resp.data);
  },
  update(researchers) {
    return api.put("/researchers", researchers).then((resp) => resp.data);
  },
  resetPasswordAll(ids) {
    return api.post("/researchers/resetPassword", ids).then((resp) => resp.data);
  },
  login(account) {
    return api.post("/researchers/login", account).then((resp) => resp.data);
  },findByUserName(username) {
  return api.get("/researchers/username/"+username).then((resp) => resp.data);
}
};

export default researchersApi;
